package android.course.lab1;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;


public class Lab1Activity extends Activity {
    /** Called when the activity is first created. */
	private Button submitButton;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        this.findViewById(R.id.editText1);
        this.findViewById(R.id.button1);
        submitButton = (Button)findViewById(R.id.button1);
        
        submitButton.setOnClickListener(new OnClickListener() {
        	public void onClick(View v){
        		Intent nameIntent = new Intent(Lab1Activity.this, ViewActivity.class);
        		EditText nameEditor = (EditText)findViewById(R.id.editText1);
        		nameIntent.putExtra("userName", nameEditor.getText().toString());
        		startActivity(nameIntent);
        	}
       
        });
	}
    
}